﻿@model IEnumerable<Tecnosop.Dominio.INSUMO>
@{
    ViewBag.Title = "Ver todos los insumos";
    Layout = "~/Views/Insumo/_LayoutInsumo.cshtml";
}
<fieldset>
<legend>Lista de insumos</legend>
    <br />
    @(Html.Telerik().Grid(Model)
        .Name("Insumos")
        .DataKeys(keys => keys.Add(k => k.CODIGO_ITEM))
        .DataBinding(dataBinding => dataBinding.Server()
            .Delete(MVC.Insumo.Delete().GetRouteValueDictionary()))
        .Columns(columuns =>
            {
                columuns.Bound(c => c.CODIGO_ITEM)
                    .Format(Html.ActionLink("{0}", MVC.Insumo.ActionNames.Details, new { id = "{0}" }).ToString())
                    .Encoded(false)
                    .Width(150);
                columuns.Bound(c => c.TIPO_INSUMO);
                columuns.Bound(c => c.ITEM.MARCA);
                columuns.Bound(c => c.ITEM.MODELO);
                columuns.Bound(c => c.ITEM.PRECIO);
                //columuns.Bound(c => c.ITEM.SUBTIPO);
                columuns.Bound(c => c.BLANCO_Y_NEGRO)
                    .Template(c =>
                        c.BLANCO_Y_NEGRO != null
                        ? c.BLANCO_Y_NEGRO.Value
                            ? "Aplica"
                            : "No aplica"
                        : "No especificado");
                @*columuns.Template(
                    @<text>
                        @Html.ActionLink("Editar", MVC.Insumo.Edit(item.CODIGO_ITEM), new { @class = "nice radius thin white button" })
                    </text>).Width(60);*@
                columuns.Command(cmd =>
                    {
                        cmd.Custom("Editar")
                                .Text("Editar")
                                .Ajax(false)
                                .ButtonType(GridButtonType.ImageAndText)
                                .ImageHtmlAttributes(new { @class = "t-icon t-edit" })
                                .HtmlAttributes(new { @class = "nice radius verysmall white button" })
                                .Action(MVC.Insumo.ActionNames.Edit, MVC.Insumo.Name);
                        cmd.Delete()
                            .ButtonType(GridButtonType.ImageAndText)
                            .HtmlAttributes(new { @class = "nice radius verysmall red button" });
                    }).Width(170);
            })
        .Selectable()
        .Pageable(paging => paging.PageSize(10))
        .Scrollable(scrolling => scrolling.Enabled(false))
        .PrefixUrlParameters(false)
        .Sortable()
        .Filterable()
        .Groupable()
        )
</fieldset>
